import { defineStore } from 'pinia'
import { ref ,reactive} from 'vue'

export const useStore = defineStore('main', () => {

    
    const isCollapse = ref(false);
    const selectMenu = reactive([]);

    const collapseMenu = ()=>{
        isCollapse.value = !isCollapse.value;
    }
    const addMenu = (payload) =>{
          //对数据进行去重
          if(selectMenu.findIndex(item => item.path===payload.path)===-1 ){
            selectMenu.push(payload);
          }     
    }

    return {
        isCollapse,
        selectMenu,
        collapseMenu,
        addMenu
    }
    
  })